package com.huffman.smart_picture.domain.vo.pircture;

import com.huffman.smart_picture.domain.entity.Picture;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class PictureDetailVo {
    /**
     * 图片id
     */
    private Long id;

    /**
     * 原图
     */
    private String url;

    /**
     * 压缩图
     */
    private String compressUrl;

    /**
     * 分类
     */
    private String category;

    /**
     * 简介
     */
    private String introduction;

    /**
     * 标签（JSON 数组）
     */

    private List<String> tags;

    /**
     * 图片体积
     */
    private Long picSize;

    /**
     * 图片宽度
     */
    private Integer picWidth;

    /**
     * 图片高度
     */
    private Integer picHeight;

    /**
     * 图片主色调
     */
    private String picColor;

    /**
     * 上传时间
     */
    private Date uploadTime;

    /**
     * 当前用户是否点赞
     */
    private Boolean isFavorite = false;

    /**
     * 当前用户是否收藏
     */
    private Boolean isCollect = false;

    /**
     * 点赞数
     */
    private Integer favoriteCount;

    /**
     * 浏览数
     */
    private Integer viewCount;

    /**
     * 收藏数
     */
    private Integer collectCount;

    /**
     * 下载数
     */
    private Integer downloadCount;

    /**
     * 作者名
     */
    private String author;

    /**
     * 作者id
     */
    private Long authorId;
    /**
     * 作者头像
     */
    private String avatar;

    public static PictureDetailVo convert(Picture picture){
        PictureDetailVo pictureDetailVo = new PictureDetailVo();

        pictureDetailVo.setId(picture.getId());
        pictureDetailVo.setUrl(picture.getUrl());
        pictureDetailVo.setCompressUrl(picture.getCompressUrl());
        pictureDetailVo.setCategory(picture.getCategory());
        pictureDetailVo.setIntroduction(picture.getIntroduction());
//        pictureDetailVo.setTags();
        pictureDetailVo.setPicSize(picture.getPicSize());
        pictureDetailVo.setPicWidth(picture.getPicWidth());
        pictureDetailVo.setPicHeight(picture.getPicHeight());
        pictureDetailVo.setPicColor(picture.getPicColor());
        pictureDetailVo.setUploadTime(picture.getCreateTime());
        pictureDetailVo.setFavoriteCount(picture.getFavoriteCount());
        pictureDetailVo.setViewCount(picture.getViewCount());
        pictureDetailVo.setCollectCount(picture.getCollectCount());
        pictureDetailVo.setDownloadCount(picture.getDownloadCount());
//        pictureDetailVo.setAuthor();
//        pictureDetailVo.setAuthorId();
//        pictureDetailVo.setAvatar();



        return pictureDetailVo;
    }
}
